import 'package:flame/game.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../controllers/ecg_controller.dart';
import 'ecgrecordarea.dart';

Widget buildTabViewTrend() {
  var controller = Get.find<EcgController>();
  final ecgArea = EcgRecordArea();
  return Column(
    children: [
      // 顶部状态栏
      Container(
        width: double.infinity,
        height: 40,
        decoration: const BoxDecoration(color: Colors.green),
      ),

      // 波形区域，可滚动
      Expanded(
        child: SingleChildScrollView(
          scrollDirection: Axis.horizontal,
          child: SingleChildScrollView(
            scrollDirection: Axis.vertical,
            child: Container(
              width: controller.ecgRecordWaves.values.first.waveContext
                  .waveWidth(),
              height: controller.ecgRecordWaves.values.first.waveContext
                      .waveHeight() *
                  controller.ecgRecordWaves.length,
              decoration: const BoxDecoration(color: Colors.black),
              child: GameWidget(game: ecgArea),
            ),
          ),
        ),
      ),

      // 底部状态栏
      Container(
        width: double.infinity,
        height: 40,
        decoration: const BoxDecoration(color: Colors.red),
      ),
    ],
  );
}
